package com.erp.servlet;

import com.erp.bean.Emp;
import com.erp.service.EmpService;
import com.erp.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zch
 *用户注册控制器
 */
@WebServlet("/empcheak.action")
public class EmpCheakNameServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        EmpService empService = new EmpServiceImpl();
        String ename = req.getParameter("name");
        Emp flag = empService.findByName(ename);
        resp.getWriter().print(flag==null);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
